lonely integer hackerrank solution in java